Skip to content

Add Son of Grid Engine (SGE) executor - #579

Merged
hategan merged 1 commit into
ExaWorks:mainfrom
jonmarks12:feature/sge_executor
Dec 2, 2026
Merged

hategan merged 1 commit into
ExaWorks:mainfrom
jonmarks12:feature/sge_executor

Conversation

@jonmarks12

Copy link
Copy Markdown
Contributor

Adds an sge executor (alias gridengine) for Son of Grid Engine and compatible Grid Engine schedulers, built on BatchSchedulerExecutor.

What's included

  • SGEJobExecutor / SGEExecutorConfig (src/psij/executors/batch/sge.py) and the sge.mustache submit template
  • Submission via qsub -terse, status via qstat -xml, cancel via qdel
  • State mapping for SGE state strings (qw, hqw, r, t, Rr, s/S/T, Eqw, dr/dt); error states report FAILED with a pointer to qstat -j
  • Cancelled jobs (which disappear from qstat) are reported as CANCELED rather than COMPLETED
  • Slots requested are process_count * cpu_cores_per_process
  • PSIJ_NODEFILE built from $PE_HOSTFILE, one line per slot
  • Job names are sanitized for SGE's -N restrictions

Site-specific configuration

  • Parallel environment: SGEExecutorConfig(parallel_environment=...) or PSIJ_SGE_PE; per-job override with the sge.pe custom attribute
  • Memory is requested per slot (h_vmem by default); exclusive use via exclusive=true; both resource names are configurable
  • GPUs (gpu_cores_per_process) are requested only if gpu_resource is set (e.g. ngpus), since GPU resource names vary by site; counted per job by default, or per slot with
    gpu_per_slot=True
  • Other sge.<key> custom attributes render as #$ -<key> <value>

As far as I can tell no other executor reads an environment variable for configuration. I added PSIJ_SGE_PE because the PE is needed for nearly every multi-slot job and is fixed
per site, but I'm happy to drop it and go config-only if you'd prefer.

Limitation

GE has no node-count request that I know of. Host placement depends on the PE's allocation_rule, so node_count/processes_per_node are honored only when the PE matches. The
executor logs a warning when more than one node is requested, and test_nodes is skipped for sge.

Tests

  • New unit tests in tests/test_sge.py (status parsing, state mapping, cancel handling, script generation including slots, memory, and GPU requests)
  • Ran the full test suite on the University of Iowa Argon Cluster with
    executors=sge:single,sge:mpirun (Open MPI 4.1.4, smp PE): all pass except test_nodes (skipped, see above) and the test_executor_loading tests which fail identically on
    main without plugin path setup

Adds an `sge` executor (alias `gridengine`) built on BatchSchedulerExecutor.
Jobs are submitted with qsub, tracked with qstat -xml and canceled with qdel.

- Slots are process_count * cpu_cores_per_process, requested through a
  parallel environment. The PE comes from SGEExecutorConfig, the PSIJ_SGE_PE
  environment variable, or the per-job `sge.pe` custom attribute.
- Memory is requested per slot (h_vmem by default). Exclusive node use is
  requested with -l exclusive=true. Both resource names are configurable.
- GPUs are requested through a configurable resource (e.g. ngpus), counted
  per job by default or per slot with gpu_per_slot.
- Job names are sanitized for SGE. Other `sge.*` custom attributes become
  `#$ -<key> <value>` directives.
- SGE cannot request a node count, so a warning is logged when a job asks
  for more than one node, and test_nodes is skipped for sge.
- Adds unit tests and registers sge in conftest, test_resources, psijcli
  and the user guide.
@hategan

hategan commented Dec 2, 2026

Copy link
Copy Markdown
Collaborator

Thank you @jonmarks12.

This looks good. I think it's fine to have PSIJ_SGE_PE as long as the PE can also be set in the standard way with attributes, and it's my understanding from the code that it can.

@hategan
hategan merged commit 63b5a19 into ExaWorks:main Dec 2, 2026
6 of 19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants